package com.mo.lib.utils

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStoreOwner

/**
 * @ author：mo
 * @ data：2022/8/9:9:19
 * @ 功能：
 */


inline fun <reified VM : ViewModel> ViewModelStoreOwner.createViewModel() = ViewModelProvider(this).get(VM::class.java)

//@MainThread
//public fun <VM : ViewModel> Fragment.createViewModelLazy(
//    viewModelClass: KClass<VM>,
//    storeProducer: () -> ViewModelStore,
//    factoryProducer: (() -> ViewModelProvider.Factory)? = null
//){}

//@MainThread
//public inline fun <reified VM : ViewModel> Fragment.viewModels(
//    noinline ownerProducer: () -> ViewModelStoreOwner = { this },
//    noinline factoryProducer: (() -> ViewModelProvider.Factory)? = null
//): Lazy<VM> = createViewModelLazy(VM::class, { ownerProducer().viewModelStore }, factoryProducer)

